fix(ltx_2): use LTXModelConfig.from_dict to filter unknown config keys#39
Open
jdcruz-strategy wants to merge 1 commit into
Open
fix(ltx_2): use LTXModelConfig.from_dict to filter unknown config keys#39jdcruz-strategy wants to merge 1 commit into
jdcruz-strategy wants to merge 1 commit into
Conversation
from_pretrained() called LTXModelConfig(**config_dict) directly, which crashes when the downloaded config.json includes diffusers metadata fields like _class_name and _diffusers_version (present in e.g. Lightricks/LTX-2 and prince-canuma/LTX-2-distilled checkpoints). BaseModelConfig.from_dict() already exists to filter to valid constructor params — use it here instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LTXModel.from_pretrained()constructs the config withLTXModelConfig(**config_dict), which crashes on aTypeErrorwhenever the downloadedconfig.jsonincludes extra diffusers metadata fields (e.g._class_name,_diffusers_version). I hit this loading bothLightricks/LTX-2andprince-canuma/LTX-2-distilled.BaseModelConfig.from_dict()already exists specifically to filter a dict down to valid constructor params, butfrom_pretrained()wasn't using it. Swapping the direct constructor call for.from_dict()fixes the crash with no behavior change for already-clean config dicts.Test plan
Lightricks/LTX-2andprince-canuma/LTX-2-distilledcheckpoints.python -m mlx_video.models.ltx_2.generateend-to-end on Apple Silicon (M-series, MLX/Metal device), producing a valid output video.